package com.bwie.parkdemo.mvvm.model;

import com.bwie.lib_core.base.BaseEntity;
import com.bwie.lib_core.mvvm.base.BaseModel;
import com.bwie.lib_core.network.HttpRetrofitFactory;
import com.bwie.lib_core.network.HttpType;
import com.bwie.parkdemo.mvvm.model.entity.ParkingAllEntity;

import io.reactivex.Observable;
import io.reactivex.functions.Function;
import io.reactivex.internal.functions.Functions;
import okhttp3.RequestBody;

/**
 * 全部车位model
 * */
public class ParkingAllModel extends BaseModel {
    @Override
    public Observable<BaseEntity> request(RequestBody... bodyes) {
        Observable<ParkingAllEntity> requestParking = HttpRetrofitFactory.getInstance()
                .factory(HttpType.TOKENINTERFACE).getRetrofit().create(Api.class)
                .requestParkingAll();
        Observable<BaseEntity>ob = Observable.fromArray(requestParking).flatMap((Function) Functions.identity(), false, 1, 1);
        return ob;
    }

    @Override
    public void cleared() {

    }
}
